Answer:

The completed program is given below.

Bad Bug

Good Advice: If the length of an array is in a variable, be sure that you always use that variable where ever you need the array length. The following program does that:

PRINT "What length do you want?"
INPUT LENGTH
DIM MYDATA( 1 TO LENGTH )

FOR COUNT=1 TO LENGTH
  LET MYDATA( COUNT ) = 48.23
NEXT COUNT

FOR COUNT=1 TO  LENGTH 
  PRINT MYDATA( COUNT )
NEXT COUNT

END

Here is a program that has a bad bug in it. Can you find the bug?

PRINT "What length do you want?"
INPUT LENGTH
DIM MYDATA( 1 TO LENGTH )

FOR COUNT=1 TO 25
  LET MYDATA( COUNT ) = 48.23
NEXT COUNT

FOR COUNT=1 TO  LENGTH 
  PRINT MYDATA( COUNT )
NEXT COUNT

END

QUESTION 9:

What is the bug? What might happen when the program is run?